<?php /*a:1:{s:112:"/Users/juyaobin/Desktop/Site/app/useradmin/view/ClassifiedAndTags/CreateClassification/CreateClassification.html";i:1611900222;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>网站后台管理模版</title>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="/public/static/admin/css/admin.css" />
    <meta name="referrer" content="no-referrer" /><!-- 头部403 -->
    <!-- 图片上传 -->
    <script src="/public/static/admin/imgupdate/jquery.min.js"></script>
    <script src="/public/static/admin/imgupdate/jQuery.upload.min.js"></script>
    <link rel="stylesheet" href="/public/static/admin/imgupdate/upload.css">
    <!-- 图片上传 -->
    <script src="/public/static/admin/js/layer/layer.js"></script>
    <script src="/public/static/admin/xm-select/xm-select.js"></script>
    <script src="/public/static/tisp.js"></script>
    <style>
        body .layer-test {
            background: none;
            box-shadow: none;
        }

        /* 定制化 */
        html .layui-layer-demo {
            background-color: #eee;
        }

        .layui-layer-demo .layui-layer-title {
            border: none;
            background-color: #333;
            color: #fff;
        }
    </style>
</head>

<body>
    <div class="page-content-wrap">
        <div class="layui-tab" style="margin: 0;">
            <div class="layui-tab-content">
                <div class="layui-tab-item"></div>
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">分类名：</label>
                        <div class="layui-input-block">
                            <input type="text" name='title' required lay-verify="required"
                                placeholder="请输入分类名如： 妹妹系/姐姐系/···" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">简 介 ： </label>
                        <div class="layui-input-block">
                            <textarea type="tel" name='description' required lay-verify="required" autocomplete="off"
                                class="layui-input"></textarea>
                        </div>
                    </div>


                    <div class="layui-tab-item layui-show">
                        <form class="layui-form" style="width: 90%;padding-top: 20px;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">服务选择：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="serverHost" value="localhost" title="本服务器" checked="">
                                    <input type="radio" name="serverHost" value="sina" title="新浪">
                                    <input type="radio" name="serverHost" value="bilibili" title="哔哩哔哩">
                                </div>
                            </div>
                        </form>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">漫画封面： </label>
                        <div class="layui-input-block">
                            <div class="upload" data-type="png,jpg,jpeg,gif"
                                action='<?php echo htmlentities($useradmin); ?>classCover?classId=<?php echo htmlentities($class_id); ?>&encryption_bookId=<?php echo htmlentities($updateImage); ?>&saveType=0&time=<?php echo htmlentities($time); ?>&pictureCloudAcceleration='
                                data-num='1' id='img-list'>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form" style="width: 90%;padding-top: 20px;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">网页链接：</label>
                                <div class="layui-input-block">
                                    <input type="text" name='input_web' required lay-verify="required"
                                        title="是否为网页 如果输入了网页则就是一个网页分类" placeholder="请输入超链接地址可为空" autocomplete="off"
                                        class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">是否置顶：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="is_top" value="true" title="是" checked="">
                                    <input type="radio" name="is_top" value="false" title="否">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">是否启用：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="is_enable" value="true" title="是" checked="">
                                    <input type="radio" name="is_enable" value="false" title="否">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="padding-left: 10px;">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal button-save-changes" lay-submit
                        lay-filter="formDemo">保存更改数据</button>
                </div>
            </div>
        </div>
    </div>
    <script src="/public/static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        layui.use(['form', 'element'], function () { });
        $(function () {
            initialdata["cover.jpg"] = {
                "filename": "cover.jpg", //图片名
                "imagesId": "class_cover_0/5hi1ph7jgzggsne84of7l6oewzmqlyx7xvchptquum4uwhh6ers3q000hhw86asgk04zeg421gvldgte8g1zvk29idxz8pmtarcspqtyq05t8rp6id5jqpfalktbzoodbzcl2cd8sm3en4egfyuxnf",
                "fileServer": "<?php echo htmlentities($image_host); ?>",
                "fileUrl": "<?php echo htmlentities($image_host); ?>class_cover_0/5hi1ph7jgzggsne84of7l6oewzmqlyx7xvchptquum4uwhh6ers3q000hhw86asgk04zeg421gvldgte8g1zvk29idxz8pmtarcspqtyq05t8rp6id5jqpfalktbzoodbzcl2cd8sm3en4egfyuxnf"
            }

            $("#img-list").upload(
                function (_this, data) {
                    alert(data)
                }
            )
            $('button.button-save-changes').click(function (e) { //提交数据
                /*  var index = layer.open({
                     type: 1,
                     title: false,
                     closeBtn: 0,
                     shadeClose: false,
                     skin: 'layer-test',
                     content: '<div><img width="150" src="https://i0.hdslb.com/bfs/album/7f85abf4f2c87b70589e4b5a0b1d8fb340c0f2d4.gif"> <h1 style="text-align:center;font-size:30px;color:rgb(255,255,255);">拼命加载中</h1></div>'
                 }); */

                $title = $('input[name="title"]').val();
                $description = $('textarea[name="description"]').val();
                $web = ($('input[name="input_web"]').val()) ? $('input[name="input_web"]').val() :
                    null;
                $is_top = $('input:radio[name="is_top"]:checked').val();
                $is_enable = $('input:radio[name="is_enable"]:checked').val();
                var meIframe = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                $.ajax({
                    type: "post",
                    url: "<?php echo htmlentities($useradmin); ?>/Classified/PreservationClassInfo?class_id=<?php echo htmlentities($class_id); ?>",
                    data: {
                        'title': $title,
                        "description": $description,
                        "web": $web,
                        "is_top": $is_top,
                        "is_enable": $is_enable,
                        "token": "<?php echo htmlentities($token); ?>",
                        "coverList": postData,
                        "establish": "<?php echo htmlentities($establish); ?>",
                        "time": "<?php echo htmlentities($time); ?>",
                    },
                    dataType: "json",
                    success: function (response) {
                        if (response.code == 200) {
                            if (response.data.state == 1) {
                                successTips('操作成功', '保存数据成功', () => {
                                    parent.layer.close(meIframe); //再执行关闭
                                });
                            } else {
                                successTips('操作成功', '成功创建一个分类', () => {
                                    parent.layer.close(meIframe); //再执行关闭
                                });
                            }
                        } else {

                        }
                    }
                });
            });
        })
    </script>

</body>

</html>